// JavaScript Document

function goToTarget(url){
	window.location.href = url;
}


function checkAllBox(i){
	
		var isChecked=(document.forms[i].checkAll.checked == true);
	    var elements=document.forms[i].elements;
	    var counter=elements.length;
	    for(i=0;i<counter;i++){
			var element=elements[i];
		if(element.type=="checkbox"){
			element.checked=isChecked;
		}
	}
}


function stringDate(){
	 var enabled = 0;  //防止错误显示
	 var dateString = "";
	 var current = new Date();
	 var year = current.getFullYear();
	 var month = (parseInt(current.getMonth())+1);
	 var today = current.getDate();

	 dateString += year;
	 dateString += ((month<10) ? "0" : "") + month;
	 dateString += ((today<10) ? "0" : "") + today;
	 document.forms[0].houseCode.value = dateString;
}


function formatDate(){
	 var enabled = 0;  //防止错误显示
	 var dateFormat = "";
	 var current = new Date();
	 var year = current.getFullYear();
	 var month = (parseInt(current.getMonth())+1);
	 var today = current.getDate();
	 
	 dateFormat += year +"-";
	 dateFormat += ((month<10) ? "0" : "") + month +"-";
	 dateFormat += ((today<10) ? "0" : "") + today;
	 document.forms[0].bookTime.value = dateFormat;
}


function addItem(){
	var sourceLength = document.forms[0].sourceId.length;
	for(var i=sourceLength-1; i >=0; i--){
		if(document.forms[i].sourceId.options[0].selected){
			var newText = document.forms[0].sourceId.options[i].text;
			var newValue = document.forms[0].sourceId.options[i].value;
			var targetLength = document.forms[0].targetId.length;
		    document.forms[0].targetId.options[targetLength] = new Option(newText,newValue);
		}
	}
}


function delItem(){
	var targetLength = document.forms[0].targetId.length;
	for(var i=targetLength-1; i >=0; i--){
		if(document.forms[0].targetId.options[i].selected){
		    document.forms[0].targetId.options[i] = null;
		}
	}
}